<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:if test="${type=='CLIE'}">
	<c:set var="typeName" value="客户" />
</c:if>
<c:if test="${type=='PROV'}">
	<c:set var="typeName" value="供应商" />
</c:if>
<c:if test="${type=='COOP'}">
	<c:set var="typeName" value="外协商" />
</c:if>
<c:set var="pageTitle" value="导入${typeName}" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doSave(){
		var fn=document.getElementById("accessory_file").value.trim();
		if(fn!=null && fn!=""){
			var lowerFn=fn.toLowerCase();
			if(!lowerFn.endWith(".xls")){
				ShowAlert('提示框','上传的文件必须是excel格式！',200,100);
				return;
			}
		}
		document.getElementById("tblUpload").style.display="none";
		document.getElementById("postframe").height="100%";
		document.getElementById("postframe").style.display="";
		frm.submit();
	}
	function doCancel(){
		parent.ClosePop();
	}
	function showMe(){
		showFormErrorMsg();
		
		if(checkNavigator()[0]!="msie"){
			if(document.getElementById("accessory_file")!=null){
				document.getElementById("accessory_file").className="";
			}
		}
	}
</script>
</head>
<body oncontextmenu="return false" scroll="no" onLoad="showMe();" class="sheet modal-dialog" style="padding-top:10px;">
<div class="sheet-main" style="width:520px;" id="tblUpload">
  <form name="frm" method="post" enctype="multipart/form-data" action="/FileUpload.ihtm">
  <div class="sheet-list" style="width:100%">
    <div class="modal-main search-business">
 		<div style="width:100%;">
 			<c:set var="pageTopTitle" value="导入${typeName}" />
			<%@ include file="../inc/PageTop.jsp"%>
			
			<div class="blank12"></div> 
			<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a" >
				<tr>
			      	<th>文件名称：</th>
			      	<td>
						<input type="file" id="accessory_file" name="accessory_file" style="width:220px" class="TextBox">
						<input type="hidden" id="type" name="type" value="${type}">
						<input type="hidden" id="from_url" name="from_url" value="/base/EstImpoForm.ihtm?type=${type}">
			     	</td>
				</tr>
				<tr>
					<th class="give">导入说明：</th>
					<td class="give">
						请先定义部门员工，才能避免相关数据无法识别。
						<br>
						<c:if test="${type=='CLIE'}"><a href="/upload/ClieTemplate.xls">下载模板文件</a></c:if>
						<c:if test="${type=='PROV'}"><a href="/upload/ProvTemplate.xls">下载模板文件</a></c:if>
						<c:if test="${type=='COOP'}"><a href="/upload/CoopTemplate.xls">下载模板文件</a></c:if>
					</td>
				</tr>
			</table>
			
			</div>
		</div>
	</div>
	<div class="modal-buttom">
		<input type="button" class="buttom-a" value=" 导 入" onClick="doSave();" >
		<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();" >		
	</div>
	</form>
</div>
<iframe name="postframe" height="0" width="100%" frameborder="0" scrolling="no" style="display:none" id="postframe" src="/uploading.jsp"></iframe>
</body>
</html>